package com.flxz.user.service.impl;

import java.util.List;
import com.flxz.common.utils.DateUtils;
import com.flxz.user.domain.UserExpense;
import com.flxz.user.mapper.UserExpenseMapper;
import com.flxz.user.service.IUserExpenseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户支出Service业务层处理
 *
 * @author ruoyi
 * @date 2025-09-11
 */
@Service
public class UserExpenseServiceImpl implements IUserExpenseService
{
    @Autowired
    private UserExpenseMapper userExpenseMapper;

    /**
     * 查询用户支出
     *
     * @param expenseId 用户支出主键
     * @return 用户支出
     */
    @Override
    public UserExpense selectUserExpenseByExpenseId(Long expenseId)
    {
        return userExpenseMapper.selectUserExpenseByExpenseId(expenseId);
    }

    /**
     * 查询用户支出列表
     *
     * @param userExpense 用户支出
     * @return 用户支出集合
     */
    @Override
    public List<UserExpense> selectUserExpenseList(UserExpense userExpense)
    {
        return userExpenseMapper.selectUserExpenseList(userExpense);
    }

    /**
     * 新增用户支出
     *
     * @param userExpense 用户支出
     * @return 结果
     */
    @Override
    public int insertUserExpense(UserExpense userExpense)
    {
        userExpense.setCreateTime(DateUtils.getNowDate());
        return userExpenseMapper.insertUserExpense(userExpense);
    }

    /**
     * 修改用户支出
     *
     * @param userExpense 用户支出
     * @return 结果
     */
    @Override
    public int updateUserExpense(UserExpense userExpense)
    {
        userExpense.setUpdateTime(DateUtils.getNowDate());
        return userExpenseMapper.updateUserExpense(userExpense);
    }

    /**
     * 批量删除用户支出
     *
     * @param expenseIds 需要删除的用户支出主键集合
     * @return 结果
     */
    @Override
    public int deleteUserExpenseByExpenseIds(Long[] expenseIds)
    {
        return userExpenseMapper.deleteUserExpenseByExpenseIds(expenseIds);
    }

    /**
     * 删除用户支出信息
     *
     * @param expenseId 用户支出主键
     * @return 结果
     */
    @Override
    public int deleteUserExpenseByExpenseId(Long expenseId)
    {
        return userExpenseMapper.deleteUserExpenseByExpenseId(expenseId);
    }
}
